import { createVNode, render, getCurrentInstance } from 'vue'
import affixConstructor from './affix.vue'

/**
 * 客服固钉（悬浮按钮）
 */
const affix = () => {
    const { appContext } = getCurrentInstance()!
    const container = document.createElement('div')
    const vm = createVNode(affixConstructor)
    vm.appContext = appContext
    render(vm, container)
    document.body.appendChild(container.firstElementChild!)
}

export default affix
